package vfs.service;

/**
 *
 * @author Matthew Eavenson <durandal@uga.edu>
 * 
 */
public interface VFSNodeService {
    
    /**
     * Returns a JSON formatted String of a given node's information, when
     * provided with a starting node, and optional path information.
     * 
     * @param uid the external id of a user in the system
     * @param workingDir the id of the current working directory
     * @param pathStr an optional String representing path information relative to the starting node
     * @return a JSON formatted String of a given node's information
     */
    String info(String uid, long workingDir, String pathStr);
    
    /**
     * Creates a new virtual node, given its properties.
     * This method supports recursive creation when given a node name with slashes in it.
     * For example providing "folder1/folder2/folder3" as the node name will create
     * folder1 under the given parent, folder2 under folder1, and folder3 under folder2.
     * 
     * @param uid the external id of a user in the system
     * @param workingDir the id of the current working directory
     * @param name the new node's name (may contain slashes for recursive creation)
     * @param access the new node's public access level (ex. "read", "write", "none")
     * @param location the new node's reference to an outside source
     * @param nodeType the id of an existing node type in the system
     * @return a JSON formatted String indicating success or failure of the node's creation
     */
    String create(String uid, long workingDir, String name, String access, String location, Long nodeType);
    
    /**
     * Removes a node from the system, give its id, and optional path information. This method is not recursive,
     * and will not remove directories.
     * For that functionality, try remove(String uid, long nodeId, String pathStr, boolean recursive).
     * 
     * @param uid the external id of a user in the system
     * @param workingDir the id of the current working directory
     * @param pathStr an optional String representing path information relative to the starting node
     * @return a JSON formatted String indicating success or failure of the node's removal
     */
    String remove(String uid, long workingDir, String pathStr);
    
    /**
     * Removes a node from the system, give its id, and optional path information. This method will remove
     * directories if the recursive flag is set to true.
     * 
     * @param uid the external id of a user in the system
     * @param workingDir the id of the current working directory
     * @param pathStr an optional String representing path information relative to the starting node
     * @param recursive indicates whether this removal should be recursive (e.g. remove all subnodes)
     * @return a JSON formatted String indicating success or failure of the node's removal
     */
    String remove(String uid, long workingDir, String pathStr, Boolean recursive);
    
    /**
     * Returns a JSON formatted String of a list of immediate children of the specified node,
     * plus optional path information.
     * 
     * @param uid the external id of a user in the system
     * @param workingDir the id of the current working directory
     * @param pathStr an optional String representing path information relative to the starting node
     * @return a JSON formatted String representing a list of children of the specified node
     */
    String list(String uid, long workingDir, String pathStr);
    
    /**
     * Returns a JSON formatted String of a list of immediate children of the specified node,
     * plus optional path information.  
     * 
     * @param uid the external id of a user in the system
     * @param workingDir the id of the current working directory
     * @param pathStr an optional String representing path information relative to the starting node
     * @return a JSON formatted String representing a list of children of the specified node
     */
    String list(String uid, long workingDir, String pathStr, Boolean verbose);
    
    /**
     * Renames a node with a given id.
     * 
     * @param uid the external id of a user in the system
     * @param nodeId the id of the node to be renamed
     * @param name the new name of the node
     * @return a JSON formatted String notifying whether the rename was successful
     */
    String rename(String uid, long nodeId, String name);
    
    /**
     * Moves a node from a given source path to a given destination path. 
     * 
     * @param uid the external id of a user in the system
     * @param workingDir the id of the current working directory
     * @param srcPathStr the source path, in String form
     * @param destPathStr the destination path, in String form
     * @return a JSON formatted String notifying whether the move was successful or not
     */
    String move(String uid, long workingDir, String srcPathStr, String destPathStr);
    
    /**
     * Moves a node with a given id under another node with a given id. 
     * 
     * @param uid the external id of a user in the system
     * @param srcId the source node's id
     * @param destId the destination node's id
     * @return a JSON formatted String notifying whether the move was successful or not
     */
    String move(String uid, long srcId, long destId);
    
}
